/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package validators;

import java.util.Calendar;
import empregado.Empregado;
import java.util.GregorianCalendar;
import validators.annotations.ValidateAnnotationParser;
import static org.junit.Assert.*;
/**
 *
 * @author arruda
 */
public class ValidatorHealper {
    /**
     * Validate an instance of some class.
     */
    public static void testValidate(Object instance, boolean expRes, String errorMsg) {
        System.out.println("validate");
        ValidateAnnotationParser validador = new ValidateAnnotationParser();
        try {
            boolean result = validador.validate(instance);
            assertEquals(expRes, result);
        } catch (ValidatorError error) {
            assertEquals(errorMsg, error.getMessage());
        }
        return;
    }
    
    public static String gerarStringGrande(){
        String s = "";
        for (int i = 0; i < 2; i++) {
            s=s.concat("123456789012345678901234567890123456789012345678901");
        }
        return s;
    }
    public static GregorianCalendar gerarCalendarAnterior(){
        Calendar agora = GregorianCalendar.getInstance();
        GregorianCalendar antes = (GregorianCalendar) agora.clone();
        antes.add(Calendar.YEAR,-19);
        return antes;
    }
    
    public static GregorianCalendar gerarCalendarPosterior(){
        Calendar agora = GregorianCalendar.getInstance();
        GregorianCalendar depois = (GregorianCalendar) agora.clone();
        depois.add(Calendar.YEAR,+19);
        return depois;
    }
}

